package com.ncd.disease.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ncd.common.utils.ShiroUtils;
import com.ncd.disease.domain.BloodInfo;
import com.ncd.disease.mapper.BloodInfoMapper;
import com.ncd.disease.param.BloodParam;
import com.ncd.disease.service.IBloodInfoService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 血液信息登记Service业务层处理
 * 
 * @author zhouxin
 * @date 2024-06-18
 */
@Service
public class BloodInfoServiceImpl extends ServiceImpl<BloodInfoMapper, BloodInfo> implements IBloodInfoService
{


    /**
     * 查询血液信息登记列表
     * 
     * @param param 血液信息登记
     * @return 血液信息登记
     */
    @Override
    public List<BloodInfo> selectBloodInfoList(BloodParam param)
    {
        QueryWrapper<BloodInfo> wrapper = new QueryWrapper<>();
        if(!ShiroUtils.getSysUser().isAdmin()){
            wrapper.eq("bi_user_id",ShiroUtils.getUserId());
        }
        wrapper.like(StrUtil.isNotBlank(param.getPatName()),"pat_name",param.getPatName());
        wrapper.like(StrUtil.isNotBlank(param.getPatIdNo()),"pat_id_no",param.getPatIdNo());
        return  this.baseMapper.selectList(wrapper);
    }


}
